﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PMS.Logic.AutoComplete
{
    public partial class UserBasicAjax : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            String methodName = Request["method"];
            Type type = this.GetType();
            MethodInfo method = type.GetMethod(methodName);
            if (method == null) throw new Exception("method is null");
            try
            {

                method.Invoke(this, null);
            }
            catch
            {
                throw;
            }
        }

        public void GetClassUser()
        {
            string q = Request.Form["q"];
            int intQ = Commons.String2Int32(q);
            Object a = DALSession.Current.View_BD_UserDepInfoDAL.GetListBy(m => (m.ID == intQ || m.UserName.Contains(q) || m.DepName.Contains(q))).Select(m => new { value = m.UserName, text = m.UserName });
            Response.Write(JsonHelper.toJson(a));
        }
    }
}